import Wx from "../utils/Wx";
import CustomError from "../utils/CustomError";
module.exports = {
    /*
    * 增加留言
    * */
    addMessage: async function (data) {
        try {
            return await Wx.cloudFunction("message", Object.assign(
                {actionName: "addMessage"},
                data
            ))
        } catch (e) {
            throw new CustomError(e, "Message.addMessage").parse()
        }
    },

    /*
    * 删除留言
    * */
    deleteMessage: async function (id) {
        try {
            return await Wx.cloudFunction("message", {
                actionName: "deleteMessage",
                id: id
            })
        } catch (e) {
            throw new CustomError(e, "Message.deleteMessage").parse()
        }
    },

    /*
    * 获取留言记录
    * */
    /*
    * 获取记录列表
    * */
    getMessageList: async function (data = {}) {
        try {
            return await Wx.cloudFunction("message", Object.assign(
                {actionName: "getMessageList"},
                data
            ))
        } catch (e) {
            throw new CustomError(e, "Message.getMessageList").parse()
        }
    },

}